/**
 * @see 该界面是“老师界面”的子组件
 */

Component({
  options: {
    addGlobalClass: true
  },
  properties: {
    courseData: {
      type: Array,
      value: []
    },
    currWeek: {
      type: Number,
      value: 0
    }
  },
  data: {
    upperDay: ['', '一', '二', '三', '四', '五', '六', '日']
  },
  methods: {
    /**
    * @see 点击“开启考勤”按钮
    */
    bindOpenAttendance (e) {
      const { dataset } = e.currentTarget
      this.triggerEvent('openAttendance', dataset.item)
    },
    /**
    * @see 进入“考勤记录”
    */
    goToRecord (e) {
      const item = e.currentTarget.dataset.item
      item.week = this.data.currWeek
      const query = JSON.stringify(item)
      wx.navigateTo({
        url: `/pages/schoolStudy/signInManage/teacher/attendanceRecords/index?item=${query}`
      })
    },
    /**
     * @see 进入“授权管理”
     */
    goToAuthorizeManage (e) {
      const item = JSON.stringify(e.currentTarget.dataset.item)
      wx.navigateTo({
        url: `/pages/schoolStudy/signInManage/teacher/authorizeManage/index?item=${item}`
      })
    }
  }
})